import request from '@/utils/request'

export function login(data) {
  return request({
    // url: '/vue-admin-template/user/login',
    url: '/auth/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    // url: '/vue-admin-template/user/info',
    url: '/auth/info',
    method: 'get',
    params: {token}
  })
}

export function logout() {
  return request({
    url: '/auth/logout',
    method: 'post'
  })
}

export function getList() {
  return request({
    url: '/user/list',
    method: 'post',
  })
}

export function add(data) {
  return request({
    url: '/user',
    method: 'post',
    data
  })
}

export function findById(id) {
  return request({
    url: `/user/${id}`,
    method: 'get'
  })
}

export function update(id, data) {
  return request({
    url: `/user/${id}`,
    method: 'put',
    data
  })
}

export function deleteById(id) {
  return request({
    url: `/user/${id}`,
    method: 'delete'
  })
}

export function fpSeats(id, data) {
  return request({
    url: `/user/seats/${id}`,
    method: 'put',
    data
  })
}

export function getResources() {
  return request({
    url: '/auth/modules',
    method: 'get'
  })
}

export function changepwd(data) {
  return request({
    url: '/auth/changepwd',
    method: 'put',
    data
  })
}
